commonlibsse_ng\re\b/
BGSPerk.rs

1use crate::re::BGSPerkEntry::BGSPerkEntry;
2use crate::re::BSTArray::BSTArray;
3use crate::re::FormTypes::FormType;
4use crate::re::TESCondition::TESCondition;
5use crate::re::TESDescription::{TESDescription, TESDescriptionVtbl};
6use crate::re::TESForm::{TESForm, TESFormVtbl};
7use crate::re::TESFullName::{TESFullName, TESFullNameVtbl};
8use crate::re::TESIcon::{TESIcon, TESIconVtbl};
9use crate::re::offsets_rtti::RTTI_BGSPerk;
10use crate::re::offsets_vtable::VTABLE_BGSPerk;
11use crate::rel::id::VariantID;
12
13#[repr(C)]
14#[derive(Debug, PartialEq)]
15pub struct BGSPerk {
16    pub __base: TESForm,                          // 0x00
17    pub __base1: TESFullName,                     // 0x20
18    pub __base2: TESDescription,                  // 0x30
19    pub __base3: TESIcon,                         // 0x40
20    pub data: PerkData,                           // 0x50
21    pub pad55: u8,                                // 0x55
22    pub pad56: u16,                               // 0x56
23    pub perkConditions: TESCondition,             // 0x58
24    pub perkEntries: BSTArray<*mut BGSPerkEntry>, // 0x60
25    pub nextPerk: *mut BGSPerk,                   // 0x78 - NNAM
26}
27const _: () = assert!(core::mem::size_of::<BGSPerk>() == 0x80);
28
29impl BGSPerk {
30    /// Address & offset of the runtime type information (RTTI) identifier.
31    pub const RTTI: VariantID = RTTI_BGSPerk;
32
33    /// Address & offset of the virtual function table.
34    ///
35    /// The number of tables is the same as the number of classes with inherited virtual functions.
36    pub const VTABLE: [VariantID; 4] = VTABLE_BGSPerk;
37
38    /// The `FormType` value for BGSPerk.
39    pub const FORM_TYPE: FormType = FormType::Perk;
40}
41
42#[repr(C)]
43pub struct BGSPerkVtbl {
44    pub __base: TESFormVtbl,
45    pub __base1: TESFullNameVtbl,    // 0x20
46    pub __base2: TESDescriptionVtbl, // 0x30
47    pub __base3: TESIconVtbl,        // 0x40
48}
49
50#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
51#[repr(C)]
52pub struct PerkData {
53    trait_: bool,   // 0x0
54    level: i8,      // 0x1
55    numRanks: i8,   // 0x2
56    playable: bool, // 0x3
57    hidden: bool,   // 0x4
58}
59const _: () = assert!(core::mem::size_of::<PerkData>() == 0x5);
60
61#[commonlibsse_ng_derive_internal::to_bitflags]
62#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
63#[repr(u32)]
64pub enum RecordFlag {
65    NonPlayable = 1 << 2,
66    Deleted = 1 << 5,
67    Ignored = 1 << 12,
68}